home
***
CD-ROM
|
disk
|
other
***
search
/
SGI Hot Mix 8
/
Hot Mix 8.iso
/
.all
/
demos
/
Z-Mail
/
InstallIt2
(
.txt
)
< prev
next >
Wrap
Text File
|
1994-06-22
|
10KB
|
362 lines
#!/bin/csh -f
#
# CD_PATH should be set in the environment by InstallIt. Failsafe it.
#
if ( ! $?CD_PATH ) then
set CD_PATH=`find $HOTMIXDIR/demos -type d -name Z-Mail -print -prune`
endif
#
# Test to see if we're IRIX4 or IRIX5
#
switch ( `uname -r` )
case 5* :
set INST_DIR=zmail.sgi5
set KBYTES_REQ=5581
breaksw
default :
set INST_DIR=zmail.sgi
set KBYTES_REQ=10506
breaksw
endsw
set MYAPP=zmail
set CD_PATH=$CD_PATH/$INST_DIR
#
# Test to see if on the new Indy filesystem or old one.
#
set TEST_NEW=`df -k /usr | /usr/bin/awk '{print $7}'`
if ( "$TEST_NEW" == "Mounted /" ) then
set FILE_STRUCTURE=new
else
set FILE_STRUCTURE=old
endif
#
# Determine the INST_PATH name.
#
# First try /usr/tmp; then if necessary, ask for another directory.
#
if ( $KBYTES_REQ < 1000 ) then
set MBYTES_REQ=1
else
@ MBYTES_REQ = ($KBYTES_REQ) / 1000
endif
if ( $FILE_STRUCTURE == "new" ) then
set KBYTES_AVAIL=`df -k / | /bin/grep / | /usr/bin/awk '{print $5}'`
else
set KBYTES_AVAIL=`df -k /usr | /bin/grep /usr | /usr/bin/awk '{print $5}'`
endif
if ( -w /usr/tmp ) then
if ( $KBYTES_AVAIL > $KBYTES_REQ ) then
set INST_PATH=/usr/tmp/$INST_DIR
echo " "
echo "This demo requires $MBYTES_REQ Mbytes of disk space."
echo " "
echo "It will be installed in a directory named $INST_PATH"
echo "Is this OK (y/n)? \c"
set ans=($<)
if ( $ans != 'y' ) then
echo " "
echo "Do you want to install in another directory (y/n)? \c"
set ans2=($<)
if ( $ans2 != 'y' ) then
echo " "
echo "... Bye."
sleep 3
exit
else
set INST_PATH=none
endif
else
if ( -d $INST_PATH ) then
echo " "
echo "It seems the demo is already installed. Continue anyway (y/n)? \c"
set ans3=($<)
if ( $ans3 != 'y' ) then
echo " "
echo "... Bye."
sleep 3
exit
endif
rm -rf $INST_PATH
endif
endif
else
set INST_PATH=none
endif
else
set INST_PATH=none
endif
if ( $INST_PATH == "none" ) then
# Read name of installation directory.
echo " "
echo "This demo requires $MBYTES_REQ Mbytes of disk space."
LOOP1:
unset INSTDIR_FILESYS
echo " "
echo "Enter the full path name of an existing directory"
echo "in which to copy the software (or enter 'q' to quit): \c"
set ans=($<)
# Check validity of the path name. If it contains only a "/",
# this will cause a divide by zero, and fail.
set TEST1=`echo $ans | cut -f2 -d"/"`
if ( ! $#TEST1 ) then
echo " "
echo "You cannot use directory /. Please try again."
goto LOOP1
endif
if ( $ans == 'q' ) then
echo " "
echo "... Bye."
sleep 3
exit
else if ( $#ans == 0 ) then
echo " "
echo "Input error. Please try again."
goto LOOP1
else
# Check validity of the path name again. It must begin with "/".
set TEST2=`echo $ans | cut -f1 -d"/" -s`
set TEST3=`echo $ans | cut -f2 -d"/" -s`
if ( ( $#TEST2 ) || ( ! $#TEST3 ) ) then
echo " "
echo "The pathname must begin with /. Please try again."
goto LOOP1
endif
if ( -d $ans ) then
echo " "
echo "A $INST_DIR directory will be created in $ans."
echo "Is this OK (y/n)?: \c"
set ans2=($<)
if ( $ans2 != 'y' ) goto LOOP1
# Determine the space available for the filesystem
# containing the requested directory.
#
# Check to see if the directory is actually a link or an
# nfs mount and do appropriate checks.
if ( -l $ans ) then
cd $ans
set CDIR=`pwd`
set KBYTES_AVAIL=`df -k $CDIR | /usr/bin/awk '{print $5}'`
endif
touch $ans/hmtest
if ( ! -r $ans/hmtest ) then
echo "Can not write to $ans, please choose another directory."
goto LOOP1
endif
/bin/rm -f $ans/hmtest
# First, find all the mounted filesystems.
set FILESYSTEMS=`df -k | awk '{print $7}' | grep /`
# Now, beginning with the full path name of the
# requested directory, start stripping off the trailing
# subdirectory names, and compare this to the existing
# file system names. If these match exactly, then we've
# found the right file system.
set TEST4=`echo $ans | cut -f3 -d"/"`
if ( ! $#TEST4 ) then
set PATH=$ans
else
set PATH=`dirname $ans`
endif
LOOP2:
foreach FILESYSTEM ($FILESYSTEMS)
# Don't do the test if $FILESYSTEM == "/"
set TEST5=`echo $FILESYSTEM | cut -f2 -d"/"`
if ( $#TEST5 != 0 ) then
if ( $PATH == $FILESYSTEM ) then
set INSTDIR_FILESYS=$PATH
endif
endif
end
set PATH=`dirname $PATH`
# Continue looping until we've stripped the pathname
# down to only "/", or until we find the file system.
set LOOPTEST=`echo $PATH | cut -f2 -d"/"`
if (( $#LOOPTEST != 0 ) && ( ! $?INSTDIR_FILESYS )) goto LOOP2
if ( $?INSTDIR_FILESYS ) then
# Determine the available space
set KBYTES_AVAIL=`df -k $INSTDIR_FILESYS | /bin/grep $INSTDIR_FILESYS | /usr/bin/awk '{print $5}'`
else
if ( $FILE_STRUCTURE == "new" ) then
set KBYTES_AVAIL=`df -k / | /bin/grep / | /usr/bin/awk '{print $5}'`
else
echo " "
echo " ERROR: Can't determine the amount of available disk"
echo " space for the directory you requested."
echo " "
echo " Continue anyway (y/n)? \c"
set ans3=($<)
if ( $ans3 == 'y' ) then
@ KBYTES_AVAIL = ($KBYTES_REQ) + 1
else
echo " "
echo "... Bye."
sleep 3
exit
endif
endif
endif
if ( $KBYTES_AVAIL > $KBYTES_REQ ) then
if ( -w $ans ) then
# Success!!!
set INST_PATH=$ans/$INST_DIR
echo " "
else
echo " "
echo "Can't write to directory $ans."
echo "Please try again."
goto LOOP1
endif
else
echo " "
echo "Not enough disk space available."
echo " "
echo " Required space = $KBYTES_REQ Kbytes"
echo " Available space = $KBYTES_AVAIL Kbytes"
echo " "
echo "Please try again."
goto LOOP1
endif
else
echo " "
echo "Can't find directory $ans."
goto LOOP1
endif
endif
# Check installation directory.
if ( -d $INST_PATH ) then
echo " "
echo "It seems the demo is already installed. Continue anyway (y/n)? \c"
set ans3=($<)
if ( $ans3 != 'y' ) then
echo " "
echo "... Bye."
sleep 3
exit
endif
rm -rf $INST_PATH
endif
endif
# Store INST_PATH in a file so it can be communicated to the RemoveIt script.
#
# First, try to put it in /usr/tmp. If we can't, then put it in /tmp
# and in the user's home directory. If put in /tmp, the file will
# disappear if the machine is rebooted. If put in the user's home
# directory, we won't be able to find it if the user trying to remove
# the software is not the same as the user who installed it. Either
# case isn't very good, but it's the best we can do if we can't write
# to /usr/tmp.
/bin/rm -f /usr/tmp/HOTMIXPATH_$INST_DIR > /dev/null
/bin/rm -f /tmp/HOTMIXPATH_$INST_DIR > /dev/null
/bin/rm -f ~/HOTMIXPATH_$INST_DIR > /dev/null
if ( -w /usr/tmp ) then
echo "setenv INST_PATH $INST_PATH" > /usr/tmp/HOTMIXPATH_$INST_DIR
/bin/chmod 666 /usr/tmp/HOTMIXPATH_$INST_DIR
else
echo "setenv INST_PATH $INST_PATH" > /tmp/HOTMIXPATH_$INST_DIR
/bin/chmod 666 /tmp/HOTMIXPATH_$INST_DIR
echo "setenv INST_PATH $INST_PATH" > ~/HOTMIXPATH_$INST_DIR
/bin/chmod 666 ~/HOTMIXPATH_$INST_DIR
endif
#
#-----------------------------------------------------------------------
#
# Now that we've finally determined INST_PATH, do the installation.
# In this case, just copy the software and execute the application.
echo " "
echo "Installing $MYAPP. Please wait..."
/bin/cp -r $CD_PATH $INST_PATH
cat > $INST_PATH/LaunchIt <<EOF
#
# Set up the environment
#
setenv HOTMIXDIR "$HOTMIXDIR"
if ( \$?XUSERFILESEARCHPATH ) then
setenv XUSERFILESEARCHPATH "$INST_PATH/lib/Zmail:\$XUSERFILESEARCHPATH"
endif
setenv XAPPLRESDIR "$INST_PATH/lib" # Just in case
setenv ZMLIB "$INST_PATH/lib"
#
# Change back to home dir and launch
#
cd $HOME
$INST_PATH/zmail -gui
EOF
chmod a=rx $INST_PATH/LaunchIt
echo " "
echo "Done."
echo " "
echo "To run the demo, move to the $INST_PATH directory"
echo "and execute LaunchIt."
echo " "
echo " "
echo "Do you want to run the demo now (y/n)? \c"
set ans=($<)
if ( $ans == 'y' ) then
$INST_PATH/LaunchIt
else
echo "... Bye."
sleep 3
endif
exit 0